package com.sxt.springcloud.bus.fallback;

import com.sxt.bus.vo.SalesbackVo;
import com.sxt.springcloud.bus.SalesbackClientService;
import com.sxt.sys.common.DataGridView;
import com.sxt.sys.common.ResultObj;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class SalesbackClientFallbackService implements FallbackFactory {
    @Override
    public Object create(Throwable throwable) {
        return new SalesbackClientService(){

            /**
             * 查询
             *
             * @param salesbackVo
             */
            @Override
            public DataGridView loadAllSalesback(SalesbackVo salesbackVo) {
                return new DataGridView("服务降级，服务器忙，请稍后重试！调用查询所有销售方法信息");
            }

            /**
             * 添加退货信息
             *
             * @param id
             * @param number
             * @param remark
             */
            @Override
            public ResultObj addSalesback(Integer id, Integer number, String remark) {
                return ResultObj.SERVER_BUSY;
            }
        };
    }
}
